@import './tables/DateTable/date-table.scss';
@import './tables/period-table.scss';

.q-date-picker {
  .q-date-editor {
    --field-box-shadow-focus: -1px -1px 3px rgba(var(--color-rgb-white), 0.25),
      1px 1px 3px rgba(var(--color-rgb-blue), 0.4),
      inset -1px -1px 1px rgba(var(--color-rgb-white), 0.7),
      inset 1px 1px 2px rgba(var(--color-rgb-blue), 0.2);

    position: relative;
    display: inline-block;
    text-align: left;

    .q-input__icon.q-icon-close {
      color: var(--color-primary-blue);
      cursor: pointer;

      &:hover {
        color: var(--color-primary-black);
      }
    }

    .q-range-input {
      display: inline-block;
      width: 42%;
      height: 100%;
      padding: 0;
      margin: 0;
      font-size: inherit;
      font-weight: var(--font-weight-base);
      line-height: 40px;
      color: var(--color-primary-black);
      text-overflow: ellipsis;
      white-space: nowrap;
      border: none;
      outline: none;
      appearance: none;

      &::placeholder {
        color: rgba(var(--color-rgb-gray), 0.32);
        opacity: 1;
      }
    }

    .q-range-separator {
      display: inline-block;
      width: 5%;
      height: 100%;
      padding: 0 2px;
      margin: 0;
      font-size: 14px;
      line-height: 32px;
      color: var(--color-primary-black);
      text-align: center;
    }
  }

  .q-range-editor {
    display: inline-flex;
    align-items: center;
    width: 100%;
    padding-left: 5px;
    cursor: pointer;
    background-color: var(--color-tertiary-gray-light);
    border: none;
    border-radius: var(--border-radius-base);
    outline: none;
    box-shadow: var(--box-shadow-primary);

    .q-form-item_is-error & {
      border: var(--border-error);
    }

    &:hover:not(.q-range-editor_disabled) {
      background-color: var(--color-tertiary-gray);
      box-shadow: var(--box-shadow-hover);
    }

    .q-range-input {
      line-height: 1;
      text-align: center;
      background: none;
    }

    .q-input__icon {
      margin-left: auto;
    }

    &_focused {
      background-color: var(--color-tertiary-gray-ultra-light);
      outline: none;
      box-shadow: var(--field-box-shadow-focus);
    }

    &_disabled {
      cursor: not-allowed;
      background-color: var(--color-tertiary-gray);
      box-shadow: var(--box-shadow-pressed);

      .q-range-separator,
      .q-range-input {
        color: var(--field-color-disabled);
        cursor: not-allowed;
      }
    }
  }

  .q-picker-panel {
    z-index: 1;
    border-radius: 4px;

    &__content {
      position: relative;
      box-sizing: border-box;
      flex-shrink: 0;
      width: 220px;
      background: var(--color-tertiary-gray-light);
      border-radius: 4px;
      box-shadow: var(--box-shadow-pressed);

      &_no-right-borders {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
      }

      &_no-left-borders {
        margin-left: 1px;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
      }

      &_focused {
        z-index: 2;
        border-radius: 4px;
        outline: none;
        box-shadow: var(--box-shadow-secondary);
        transition: transform 0.2s;
        transform: scale(1.03);
      }
    }

    &__sidebar {
      flex-shrink: 0;
      width: 114px;
      padding: 16px 8px;
      overflow: auto;
      background: var(--color-tertiary-gray-light);
      border-top-left-radius: 4px;
      border-bottom-left-radius: 4px;
      box-shadow: var(--box-shadow-pressed);

      & + .q-picker-panel__content {
        margin-left: 1px;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
      }
    }

    &__body,
    &__body-wrapper {
      display: flex;
      flex-shrink: 0;
      height: 100%;
      background: var(--color-tertiary-gray-light);
      border-radius: 4px;
      box-shadow: var(--box-shadow-secondary);

      &::after {
        display: table;
        clear: both;
        content: '';
      }
    }

    &__header {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 8px 0;
      text-align: center;
      text-transform: uppercase;

      &-sign {
        display: flex;
        flex-basis: 72px;
        justify-content: center;
        margin-right: 12px;
        margin-left: 12px;
        font-size: 12px;
        font-weight: 600;
        line-height: 15px;
        color: var(--color-primary-black);
        white-space: nowrap;
      }
    }

    &__header-label {
      padding: 0;
      font-weight: 600;
      line-height: 15px;
      color: var(--color-primary-black);
      text-transform: uppercase;
      white-space: nowrap;
      cursor: pointer;
      user-select: none;
      border: none;

      &:nth-child(2) {
        margin-left: 5px;
      }

      &[data-focus-visible-added],
      &:hover:not(.q-picker-panel__header-label_hoverless) {
        color: var(--color-primary-blue);
      }
    }

    &__shortcut {
      display: block;
      width: 100%;
      padding-bottom: 8px;
      font-size: 10px;
      line-height: 12px;
      color: rgba(var(--color-rgb-gray), 0.64);
      text-align: left;
      cursor: pointer;
      background-color: transparent;
      border: 0;
      outline: none;

      &:hover {
        color: var(--color-primary-blue);
      }

      &[data-focus-visible-added] {
        color: var(--color-primary-blue);
        text-decoration: underline;
      }
    }

    &__icon-btn {
      width: 20px;
      min-width: 20px;
      height: 20px;
      padding: 0;
      font-size: 20px;
      color: var(--color-primary-blue);
      cursor: pointer;
      background: var(--color-tertiary-gray-light);
      border: 0;
      border-radius: 20px;
      outline: none;
      box-shadow: var(--box-shadow-primary);

      &:hover {
        color: var(--color-primary-black);
      }

      &[data-focus-visible-added] {
        color: var(--color-primary-black);
        background-color: var(--color-tertiary-gray);
      }

      &_disabled {
        color: var(--color-tertiary-gray-ultra-darker);

        &:hover {
          color: var(--color-tertiary-gray-ultra-darker);
          cursor: not-allowed;
        }
      }
    }

    &__link-btn {
      vertical-align: middle;
    }
  }
}
